﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Threading.Tasks;
using System.Web.Http;
using d1Common;
using d1Common.WebController;
using d1Project.Modules.Common.doLog.Services;
using Newtonsoft.Json;

namespace d1Project.Modules.Common.do4A.Controllers.a
{
    /// <summary>
    /// 1．来电弹屏数据推送
    /// </summary>
    [Route("api/call")]
    public class callController : ControllerBase
    {
        protected override DbContext dbContext
        {
            get
            {
                return null;
            }
        }
        private do4ADbContext db = new do4ADbContext();
        //[HttpGet]
        //public async Task<IHttpActionResult> Get([FromUri] GetVmcall GetVmcall)
        //{
        //    Res res = new Res();

        //    doServices.Instance.DoLog.Info("ts", "来电弹屏数据推送");

      
        //    if (GetVmcall != null)
        //    {
        //        var data = JsonConvert.DeserializeObject<PostVmcall>(GetVmcall.data);

        //        doServices.Instance.DoLog.Info("ts", "来电弹屏数据推送数据为：" + "customerNo:" + data.customerNo + "," + "phone:" + data.phone + "," + "reportNum:" + data.reportNum + "," + "uqid:" + data.uqid + "district:" + data.district);
        //    }
        //    res.status = true;
        //    res.message = "调用接口成功";

        //    return Ok(res);
        //}

        [HttpPost]
        public async Task<IHttpActionResult> Post([FromBody]GetVmcall GetVmcall)
        {

            Res res = new Res();

            doServices.Instance.DoLog.Info("ts", "来电弹屏数据推送");

            if (GetVmcall != null)
            {
                var data = JsonConvert.DeserializeObject<PostVmcall>(GetVmcall.data);

                doServices.Instance.DoLog.Info("ts", "来电弹屏数据推送数据为：" + "customerNo:" + data.customerNo + "," + "phone:" + data.phone + "," + "reportNum:" + data.reportNum + "," + "uqid:" + data.uqid + "district:" + data.district);
            }
            res.status = true;
            res.message = "调用接口成功";

            return Ok(res);
        }
    }

    public class GetVmcall
    {
        public string data { get; set; }
    }

    public class PostVmcall
    {
        /// <summary>
        /// 
        /// </summary>
        public string customerNo { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string phone { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string reportNum { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string uqid { get; set; }
        /// <summary>
        /// 上海市
        /// </summary>
        public string district { get; set; }
    }
}